<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>利用构造函数创建对象</title>
</head>
<body>
  <script>
    /* 没有类之前 创建类的方法 */
    function Star (uname,uage) {
      this.uname = uname;
      this.uage = uage;
      this.sing = function () {
        console.log(this.uname + '会唱歌');
      }
    }
    var ldh = new Star('刘德华',18);
    var zxy = new Star('张学友',20);
    ldh.sing();
    zxy.sing();
  </script>
</body>
</html>